import axios from 'axios'
import {baseApi} from '@/global.js'

const service = axios.create({
    timeout:5000,
    baseURL:baseApi
})

service.interceptors.request.use(
    config => {
        return config
    },
    error => {
        Promise.reject(error)
    }
)

service.interceptors.response.use(
    response => {
        let res = response.data;
        return res
    },
    error => {
        let e = error.toString()
        // Message.error(e)
        return Promise.reject(e)
    }
)

export default service